package com.zry.fertilizer.view

import android.content.Context
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.zry.fertilizer.R
import com.zry.fertilizer.adapter.BaseSpinnerAdapter
import com.zry.fertilizer.animation.MyBaseViewHolder
import com.zry.fertilizer.been.*


class DocumentStatusAdapter(layoutResId: Int, data: MutableList<DocumentStatusBean>?) : BaseQuickAdapter<DocumentStatusBean, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: DocumentStatusBean?) {
        helper?.setText(R.id.leftDocumentStatus, item?.documentName)
    }
}

class ProductNameAdapter(layoutResId: Int, data: MutableList<ProductNameBean>?) : BaseQuickAdapter<ProductNameBean, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: ProductNameBean?) {
        helper?.setText(R.id.leftDocumentStatus, item?.ProductName)
    }
}

class BatchNameAdapter(layoutResId: Int, data: MutableList<BatchInfoBean>?) : BaseQuickAdapter<BatchInfoBean, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: BatchInfoBean?) {
        helper?.setText(R.id.leftDocumentStatus, item?.BatchName)
    }
}

class CustomerInfoAdapter(layoutResId: Int, data: MutableList<CustomerInfo>?) : BaseQuickAdapter<CustomerInfo, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: CustomerInfo?) {
        helper?.setText(R.id.leftDocumentStatus, item?.CustomerName)
    }
}

class PutStorageAdapter(layoutResId: Int, data: MutableList<PutState>?) : BaseQuickAdapter<PutState, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: PutState?) {
        helper?.setText(R.id.leftDocumentStatus, item?.putStorageName)
    }
}


class BatchOPeraPopupAdapter(layoutResId: Int, data: MutableList<BatchOPera>?) : BaseQuickAdapter<BatchOPera, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: BatchOPera?) {
        helper?.setText(R.id.leftDocumentStatus, item?.OperaName)
    }
}

class FirstAdapter(layoutResId: Int, data: MutableList<DocumentStatusBean>?) : BaseQuickAdapter<DocumentStatusBean, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: DocumentStatusBean?) {
        helper?.setText(R.id.leftDocumentStatus, item?.documentName)
        helper?.setBackgroundRes(R.id.leftDocumentStatus, R.color.main_background_color)
    }
}

class SecondAdapter(layoutResId: Int, data: MutableList<DocumentStatusBean>?) : BaseQuickAdapter<DocumentStatusBean, MyBaseViewHolder>(layoutResId, data) {
    override fun convert(helper: MyBaseViewHolder?, item: DocumentStatusBean?) {
        helper?.setText(R.id.leftDocumentStatus, item?.documentName)
    }
}

class ProductNameSpinnerAdapter(context: Context, data: MutableList<ProductInfo>) : BaseSpinnerAdapter<ProductInfo>(context, data) {
    override fun convert(convertView: TextView, item: ProductInfo?) {
        convertView.text = item?.ProductName
    }
}

class ModelSpinnerAdapter(context: Context, data: MutableList<ModelBean>) : BaseSpinnerAdapter<ModelBean>(context, data) {
    override fun convert(convertView: TextView, item: ModelBean?) {
        convertView.text = item?.ModelName
    }
}


